﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using CapaDeDominio;
using CapaDeDatos.EF.ORM;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace CapaDeDatos.EF
{
    public class EFContext : DbContext
    {
        public EFContext(string cadenaConexion)
            : base(cadenaConexion)
        {
            Database.SetInitializer<EFContext>(null);
        }

        public DbSet<Local> Locales { get; set; }
        public DbSet<Sala> Salas { get; set; }
        public DbSet<Cliente> Clientes { get; set; }
        public DbSet<Reserva> Reservas { get; set; }
        public DbSet<Maestra> Maestras { get; set; }
        public DbSet<Servicio> Servicios { get; set; }
        public DbSet<Instrumento> Instrumentos { get; set; }
        public DbSet<Usuario> Usuarios { get; set; }
        //public DbSet<Detalle_reserva_instrumento> DetalleReservaInstrumentos { get; set; }
        //public DbSet<Detalle_reserva_servicio> DetalleReservaServicios { get; set; }
        //public DbSet<Detalle_sala_instrumento> DetalleSalaInstrumentos { get; set; }
        //public DbSet<Detalle_sala_servicio> DetalleSalaServicios { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

            modelBuilder.Configurations.Add(new LocalMapping());
            modelBuilder.Configurations.Add(new SalaMapping());
            modelBuilder.Configurations.Add(new ClienteMapping());
            modelBuilder.Configurations.Add(new ReservaMapping());
            modelBuilder.Configurations.Add(new MaestraMapping());
            modelBuilder.Configurations.Add(new ServicioMapping());
            modelBuilder.Configurations.Add(new InstrumentoMapping());
            modelBuilder.Configurations.Add(new UsuarioMapping());
            //modelBuilder.Configurations.Add(new DetalleReservaInstrumentoMapping());
            //modelBuilder.Configurations.Add(new DetalleReservaServicioMapping());
            //modelBuilder.Configurations.Add(new DetalleSalaInstrumentoMapping());
            //modelBuilder.Configurations.Add(new DetalleSalaServicioMapping());
            base.OnModelCreating(modelBuilder);
        }
    }
}